package com.example;

import com.example.dao.EmployeeDao;
import com.example.entity.Employee;

import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @date 2020/8/13 22:04
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring.xml"})
public class EmployeeSave {
    @Qualifier("employeeDao")
    @Autowired
    private EmployeeDao employeeDao;
    @Test
    /*增加一条员工信息*/
    public void save(){
        /*ApplicationContext ioc = new ClassPathXmlApplicationContext("spring.xml");
        EmployeeDao employeeDao = ioc.getBean(EmployeeDao.class);*/
        Employee employee = new Employee();
        employee.setAge(12);
        employee.setName("Dw");
        employee.setSex("男");
        employee.setAddress("上海");
        employeeDao.insert(employee);


    }
}
